package com.fesine.learn.design.pattern.creational.singleton;

/**
 * @description: 类描述
 * @author: fesine
 * @createTime:2019/3/31
 * @update:修改内容
 * @author: fesine
 * @updateTime:2019/3/31
 */
public class StaticInnerClassSingleton {

    private static class InnerClass{
        private static StaticInnerClassSingleton staticInnerClassSingleton =
                new StaticInnerClassSingleton();
    }

    public static StaticInnerClassSingleton getInstance(){
        return InnerClass.staticInnerClassSingleton;
    }

    private StaticInnerClassSingleton(){
        if(InnerClass.staticInnerClassSingleton != null){
            throw new RuntimeException("单例构造器禁止反射调用");
        }
    }
}
